<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>后台管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="lib/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="css/admin.css" media="all">
	</head>
	<body>
        <div class="layui-fluid">
			<div class="layui-col-md12">
				<div class="layui-navs">
					<span class="layui-breadcrumb" lay-separator="—">
						<a href="javascript:;">系统设置</a>
						<a href="javascript:;">其他设置</a>
						<a><cite>清空缓存</cite></a>
					</span>
					<a class="layui-btn layui-btn-small" style="line-height:1.6em;float:right;height: 36px;" href="javascript:location.replace(location.href);" title="刷新">
						<i class="layui-icon layui-icon-refresh" style="line-height:36px;font-size: 16px;"></i>
					</a>
				</div>
			</div>
			<div class="layui-col-md12">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-card" style="position: relative;left: 20px;top: 20px;">
								<button type="button" class="layui-btn" id="clear_cache">清空文件缓存</button>
								<button type="button" class="layui-btn layui-btn-normal" id="clear_temp">清空临时文件缓存</button>
								<button type="button" class="layui-btn layui-btn-danger" id="clear_log">清空系统日志</button>
							</div>
						</div>
					</div>
				</div>
			</div>	
        </div>
    </body>
</html>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="lib/layui/layui.js"></script>
<script src="js/admin.js"></script>
<script>
    $('#clear_cache').click(function(){
        layer.confirm('确认要清空文件缓存吗？',function(index){
            layer.load();
            $.ajax({
                url:'',
                type:'Post',
                data:{type:1},
                dataType:'json',
                success:function(data){
                    layer.closeAll('loading');
                    if (data.code == 0) {
                        layer.msg(data.message,{icon:1,time:1000});return false;
                    }else{
                        layer.msg(data.message,{icon:2,time:1000});return false;
                    }
                },
				error : function(e){
					layer.closeAll('loading');
					layer.msg(e.responseText, {icon: 2, time: 1000});
				}
            });
			return false;
        })
    })

    $('#clear_temp').click(function(){
        layer.confirm('确认要清空临时文件缓存吗？',function(index){
            layer.load();
            $.ajax({
                url:'',
                type:'Post',
                data:{type:2},
                dataType:'json',
                success:function(data){
                    layer.closeAll('loading');
                    if (data.code == 0) {
                        layer.msg(data.message,{icon:1,time:1000});return false;
                    }else{
                        layer.msg(data.message,{icon:2,time:1000});return false;
                    }
                },
				error : function(e){
					layer.closeAll('loading');
					layer.msg(e.responseText, {icon: 2, time: 1000});
				}
            });
			return false;
        })
    })

    $('#clear_log').click(function(){
        layer.confirm('确认要清空系统日志吗？',function(index){
            layer.load();
            $.ajax({
                url:'',
                type:'Post',
                data:{type:3},
                dataType:'json',
                success:function(data){
                    layer.closeAll('loading');
                    if (data.code == 0) {
                        layer.msg(data.message,{icon:1,time:1000});return false;
                    }else{
                        layer.msg(data.message,{icon:2,time:1000});return false;
                    }
                },
				error : function(e){
					layer.closeAll('loading');
					layer.msg(e.responseText, {icon: 2, time: 1000});
				}
            });
			return false;
        })
    })
</script>